<?php

/**
 * This is the model class for table "activities".
 *
 * The followings are the available columns in table 'activities':
 * @property integer $id
 * @property string $city
 * @property string $contact_via
 * @property string $institution_name
 * @property string $address
 * @property string $phone
 * @property string $fax
 */
class Activities extends CActiveRecord
{
  public $verifyCode;
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Activities the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'activities';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('city, contact_via, institution_name, address, phone, fax', 'required'),
			array('id', 'numerical', 'integerOnly'=>true),
      // array('verifyCode', 'CaptchaExtendedValidator', 'allowEmpty'=>!CCaptcha::checkRequirements()),
			array('city, contact_via', 'length', 'max'=>500),
			array('institution_name, address, phone, fax', 'length', 'max'=>1000),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, city, contact_via, institution_name, address, phone, fax', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'city' => 'Kota <i>City</i>',
			'contact_via' => 'Silahkan menghubungi kami via <i>Please reach us via :</i>',
			'institution_name' => 'Nama Institusi <i>Institution Name</i>',
			'address' => 'Alamat <i>Address</i>',
			'phone' => 'Telepon <i>Phone</i>',
			'fax' => 'Faks <i>Fax</i>',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('city',$this->city,true);
		$criteria->compare('contact_via',$this->contact_via,true);
		$criteria->compare('institution_name',$this->institution_name,true);
		$criteria->compare('address',$this->address,true);
		$criteria->compare('phone',$this->phone,true);
		$criteria->compare('fax',$this->fax,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}